package com.gzxt.agricultural.controller;

import com.gzxt.agricultural.bo.User;
import com.gzxt.agricultural.service.UserService;
import com.gzxt.agricultural.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

@RestController
@RequestMapping("/user")
@CrossOrigin
public class UserController {
    @Autowired
    private UserService userService;

    @PostMapping("/register")
    public Result register(@Valid @RequestBody User user){
        System.out.println(user);
        Result result = userService.register(user);
        return result;
    }

}
